Skip to content

fix(host): a share-seq reservation is not a line the room said (#2855) - #2863

Open
HugoXK wants to merge 2 commits into
ThinkFlowLab:mainfrom
HugoXK:dev/3-takelineseq-gap
Open

HugoXK wants to merge 2 commits into
ThinkFlowLab:mainfrom
HugoXK:dev/3-takelineseq-gap

Conversation

@HugoXK

@HugoXK HugoXK commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #2855

Owner: Dev-3
Reviewer: Birfy
Written-by: Dev-3
Bot: Dev-3
Claim-Id: 1c8863ae0c9846ea917e3eb9dcd99282
Risk tier: T2
Base: bdaff4f
Tip: 72276f3
Tree: 4fa3f6add7fe2cf1de7d02699ae1492d86a39b42

What changed

A regression #2839 introduced. That fix made read_group_chat count a trimmed log honestly: the total is kept.length plus room.seq - room.log.length, which reads "every seq number above the retained window was a line the cap dropped". takeLineSeq broke that premise: it reserved a remote line number for a co-seat mention by moving room.seq and wrote no line, so each reservation looked like a dropped line and the header grew one phantom row per mention — a five-line log said newest 5 of 6, oldest first after one reservation and still showed all five.

The reservation now keeps its own counter, room.shareSeq, which starts above everything already said and is never room.seq; room.seq keeps its meaning (one per written line), so the trimmed-room total is right again. #1126 is unchanged in what it needs — a second mention still gets a new number, so its envelope is a new remote line instead of a redelivery of seq 0. docs/subsystems/core-host.md records the reservation rule and docs/subsystems/plugin-runtime.md (owner of hooks.js) corrects the takeLineSeq sentence.

Red first (base bdaff4f, test-only tree)

core/test/room-read-trimmed-count.test.js — five lines, one takeLineSeq reservation, then the same read:

not ok 6 - \#2855: a share-seq reservation writes no line, so the read is byte-identical
  message: 'a reservation writes no line, so nothing was left out'
  + 'Latest in "Ops" (newest 5 of 6, oldest first):\n' +
  - 'Latest in "Ops" (oldest first):\n' +
      'Writer: message 1: the merge queue slipped again\n' +
      ...
# tests 6
# pass 5
# fail 1

Two runs, normalized only for duration_ms and the random /tmp/ds-bot-p684-* home directory, are byte-identical (cmp clean).

Ran

(cd core && DSH_HARNESS=… npm test)                     # 3090/3093; the 3 red are red on the base too
(cd core && DSH_HARNESS=… node --import ./test/harness-resolve.mjs --test test/room-read-trimmed-count.test.js)   # 6/6
(cd core && DSH_HARNESS=… node --import ./test/harness-resolve.mjs --test room-read-*, room-share-braces, room-collaboration, room-context, groups, group-work, room-membership, remote-room)  # 225/225
node scripts/ds-bot-patches.mjs generate && node scripts/ds-bot-patches.mjs check     # ok, 10 patches, core/ equals ds-bot/ + patches
node core/scripts/build-client.mjs --check                                           # exit 0
ARCH_DOCS_BASE=bdaff4fb92cb… node core/scripts/check-arch-docs.mjs                   # OK (7 changed files)
node .github/scripts/changelog.mjs check                                             # 15 fragments well formed
(cd core && DSH_HARNESS=… npm run lint)                                              # 0 errors (88 warnings, pre-existing)

The 3 red tests in the full suite are red on base bdaff4fb by the same commands: bench-preflight refuse/install (pnpm absent on this box) and thinking-row #1718 ('min(560px, 78%)' vs 'min(560px,78%)'); 16/19 pass in those two files on the base.

Not run

Plugin suites (no plugins/** change) and the root npm run verify; smoke bench (no index.js/src/host/** smoke surface — hooks.js only, but see Ran for the host suite).

Generated

generate rewrote patches/ds-bot/files/src/host/hooks.js and patches/ds-bot/files/test/room-read-trimmed-count.test.js (both are whole-file mirrors; hooks.js is a FlyBot-added file, so no *.patch changed). patches check reports core/ equals ds-bot/ + patches/ds-bot/.

Risk tier

risk-tier: T2; basis: core/src/host/hooks.js=T2, changelog.d/2855-room-read-take-line-seq.fixed.md=T1, core/test/room-read-trimmed-count.test.js=T1, patches/ds-bot/files/src/host/hooks.js=T1, patches/ds-bot/files/test/room-read-trimmed-count.test.js=T1, docs/subsystems/core-host.md=T0, docs/subsystems/plugin-runtime.md=T0

T2 because of the core/src/host/hooks.js path, computed by the base copy of risk-gate.mjs and .github/agent/risk-rules.json; no gate file changed, so no Policy-sign: line.

Checkpoint

{"pr":2863,"claim":"Dev-3","issue":2855,"summary":"read_group_chat counted a share-seq reservation as a line the room said, so a co-seat mention that wrote no line printed one phantom dropped line and the count grew per mention. takeLineSeq now keeps room.shareSeq, starting above everything already said, and never moves room.seq, which still counts written lines only. A five-line log therefore reads byte-identically before and after a reservation, a second mention still gets a new number, and a room whose log really was trimmed still reports what the cap dropped. Tests pin both on the real runtime.","files":["core/src/host/hooks.js","core/test/room-read-trimmed-count.test.js","docs/subsystems/core-host.md","docs/subsystems/plugin-runtime.md","changelog.d/2855-room-read-take-line-seq.fixed.md","patches/ds-bot/files/src/host/hooks.js","patches/ds-bot/files/test/room-read-trimmed-count.test.js"],"checks":{"ran":"node --import ./test/harness-resolve.mjs --test test/room-read-trimmed-count.test.js","result":"green","at":"72276f3ef224fbea0de1fa3df5fe4f5956f49629"},"next":"none — ready for review"}

@HugoXK

HugoXK commented Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

@Birfy review request — tip 72276f3ef224fbea0de1fa3df5fe4f5956f49629.

This is a T2 change, so it needs your Verdict: PASS naming this exact tip before it can be enqueued.

  • 19 checks at that tip: 15 success + 2 skipped + 1 cancelled / 1 failure. The one failure is enqueue-guard, and it fails with exactly do not enqueue #2863: no Verifier report names the tip 72276f3e — that is the T2 gate waiting on you, not a defect.
  • mergeable_state: unstable (only because of that gate); maintainer_can_modify: true; branch dev/3-takelineseq-gap, 7 files +61/−14.
  • What it does: read_group_chat counted takeLineSeq reservations as lines that were said, so a room with 5 lines reported newest 5 of 6 once a co-seat mention had reserved a sequence number. takeLineSeq now keeps its own counter (room.shareSeq, seeded from room.seq), so room.seq counts only lines actually written; the row formula from bug(host): a trimmed room log makes read_group_chat report the wrong total #2839 holds again. Red first: the new case prints newest 5 of 6 on the base tree and Latest in "Ops" (oldest first): after the fix.
  • docs touched by arch-docs: core-host.md and plugin-runtime.md (the takeLineSeq advances room.seq sentence), plus a changelog fragment per the bug(host): a trimmed room log makes read_group_chat report the wrong total #2839 precedent.

One request for this tip; no new commits will be pushed under it.

FlyBot Dev-3 added 2 commits November 11, 2026 11:07
…FlowLab#2855)

`takeLineSeq` reserved a remote line number by moving `room.seq`, but a
reservation writes no line: the room read subtracted the retained log from
that counter, so each co-seat mention printed one phantom line as dropped
(`newest 5 of 6` on a five-line log) and the count only grew.

The reservation now keeps its own counter, `room.shareSeq`, starting above
everything already said; `room.seq` still counts written lines only, so the
trimmed-room total is right again and a second mention still gets a new
number.

Written-by: Dev-3
Bot: Dev-3
…#2855)

The page said the reservation advances `room.seq` the way a stored line
does; it now keeps `room.shareSeq`, because a reservation writes no line
and the room read would report it as a dropped one.

Written-by: Dev-3
Bot: Dev-3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

read_group_chat: "of N" counts takeLineSeq reservations that never wrote a line

1 participant